1. Field of the Invention
The present invention relates to an image compression apparatus, which compresses image data, and particularly relates to an image compression apparatus, which divides an image for compression into a plurality of blocks, and compresses them.
2. Description of Related Art
In an apparatus, such as a digital multi-function peripheral (MFP), in case when saving bit map image data into a memory or a hard disk drive, compression and saving of the image data are performed to reduce a required storage capacity.
One of the compression technologies is a BTC (Block Truncation Coding) compression technology. In BTC compression, the image to be compressed is divided into blocks, each of which has a predetermined number of pixels (for example, 4 pixels×4 pixels). Then, the BTC generates compressed data, which expresses each block with a distribution range (for example, expressed by a maximum value and a minimum value) of the gradation values of a pixel that belongs to the block, and with code data, in which the gradation value of each pixel within the block is normalized (quantized) with the number of gradations smaller than the number of gradations of the original image data in the distribution range.
When expanding the compressed data, a representative value of each value of code data is determined from the distribution range of the gradation that is expressed by the maximum value and the minimum value included in the compressed data. Then, an image is restored by converting each code data included in the compressed data into corresponding image data of the representative value.
For example, in case when performing the BTC compression by converting the image data expressing a pixel with 8 bit-256 gradations into the code data of 2 bit per pixel, the distribution range of the gradation value expressed by the maximum value and the minimum value is expressed by 2 bit-4 gradations in the compressed data. At the time of expansion, the maximum value and the minimum value of the compressed data, and two boundary values that divide the range expressed by these maximum value and minimum value into three are determined as four representative values on each code data. Then, each code data included in the compressed data is restored to a pixel having the representative values corresponding to the value of the code data as the gradation value.
In the BTC compression technology, the distribution range of the gradation in a block is normalized into the number of gradations corresponding to the number of bits of the code data. Therefore, as the distribution range of the gradation value in a block becomes wider, there is a possibility that the error between the original gradation value of the pixel and the gradation value after performing compression and expansion of the original gradation value of the pixel may become large.
Then, for example, Japanese Patent Application Publication No. H10-66072 proposes an image coding apparatus for decreasing degradation of image quality by increasing the number of bits of code data per pixel, and increasing the number of gradation at the time of normalization (quantization) in the case when the distribution range of the gradation in a block is greater than a threshold rather than a case in which the distribution range of the gradation in a block is less than a threshold. In this image coding apparatus, as shown in FIG. 7, image data 101, which has been divided into blocks, is inputted to a compression circuit 100 and has been compressed by both of a first compression circuit 102 and a second compression circuit 103. The number of gradations of each pixel after the compression by the first compression circuit 102 differs from the number of gradations of each pixel after the compression by the second compression circuit 103. The difference between the maximum value and the minimum value in a block is compared with a reference value. Then, it is determined whether to validate an output of the compression circuit 102 or an output of the compression circuit 103 based on a selector signal 104 of the comparison result. In case where difference (distribution range of the gradation value) is greater, the second compression circuit 103 having more gradations is selected when compared with a case where the difference is small.
The compressed data 111 generated by the compression circuit 100 is inputted to an expansion circuit 110. Then, the expansion circuit 110 expands this compressed data 111 with two expansion circuits 112 and 113 respectively based on bit plane information, a mean value and a deviation that are contained in the compressed data. The number of gradations of the first expansion circuit 112 differs from the number of gradations of the second expansion circuit 113. It is determined whether to validate an output of the expansion circuit 112 or an output of the expansion circuit 103 by the selector signal included in the compressed data 111. As described above, the compression in a small bit number is performed in case where the distribution range of the gradation value in a block is narrow, and the compression in a larger bit number is performed in case where the distribution range of the gradation value in a block is wider. Therefore, the image quality degradation is reduced.
Generally, since the gradation of the line itself is uniform, a line and drawing, such as characters have little image quality degradation even if the line and the drawing are normalized and compressed into a small number of gradations (number of bits). However, in the technology disclosed in Japanese Patent Application Publication, in a case where the distribution range of the gradation value in a block is greater than the reference value, the image data is compressed by the second compression circuit 103 having a large number of gradations. Therefore, since the distribution range in a block containing the outline portion of a character written on a white ground is wide, it will be compressed by the second compression circuit 103 having the large number of gradations. Since the character portion occupies the major portion of a usual document, in the above-mentioned compression method, the reduction of the compression ratio becomes a serious problem.
Since a selector signal for expressing the difference of the number of gradations at the time of compression are newly provided, the data volume corresponding to this portion will increase. Further, the reduction of the compression ratio will be caused.
An object of the present invention is to provide an image compression apparatus, which can increase a compression ratio of line drawings, such as a character, while suppressing image quality degradation, to solve the above-mentioned problems.